//
//  MineFooterView.m
//  NtoccShipper
//
//  Created by mac on 2019/11/8.
//  Copyright © 2019 zhuchongjin. All rights reserved.
//

#import "MineFooterView.h"
@interface MineFooterView()
@property (strong, nonatomic)  CJLabel* labBew;
@property (nonatomic, strong)  CJButton *phoneButton;
@property (nonatomic, strong)  CJButton *qgPhoneButton;
@end
@implementation MineFooterView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setup];
    }
    return self;
}

- (void)setup{
    self.backgroundColor = [UIColor cjWhiteColor];
    [self addSubview:self.labBew];
    [self addSubview:self.phoneButton];
    [self addSubview:self.qgPhoneButton];
}

- (CJLabel *)labBew{
    if (!_labBew) {
        _labBew = CJLabel.labInit
            .labFrame(CGRectMake(0, 0, SCREEN_WIDTH, CJCellTopPadding))
            .labBgColor([UIColor cjBackgroundColor])
        //        .labFontSize(20)
        //        .labTextColor([UIColor cjSubheadTextColor])
        //        .labAlignment(NSTextAlignmentCenter)
        //        .labText(@" 24小时服务热线 \n 400-617-5656")
        ;
    }
    return _labBew;
}

- (CJButton *)phoneButton{
    if (!_phoneButton) {
        _phoneButton = CJButton.btnInit
        .btnFrame(CGRectMake(0, 10, SCREEN_WIDTH, LW(30)))
        .btnText(CJStringWithFormat(@"全国24小时服务热线 %@",[CJControl getCustomerServicePhone]))
        .btnNormalTitleColor([UIColor cjSubheadTextColor])
        .btnBgColor([UIColor whiteColor])
        .btnTargetAction(self, @selector(btnSureAction:))
        .btnSetTag(100)
        ;
    }
    return _phoneButton;
}
- (CJButton *)qgPhoneButton{
    if (!_qgPhoneButton) {
        _qgPhoneButton = CJButton.btnInit
        .btnFrame(CGRectMake(0, CGRectGetMaxY(self.phoneButton.frame) + 5, SCREEN_WIDTH, LW(30)))
        .btnText(CJStringWithFormat(@"集团客服中心投诉热线 %@",[CJControl getCustomerServiceqgPhone]))
        .btnNormalTitleColor([UIColor cjSubheadTextColor])
        .btnBgColor([UIColor whiteColor])
        .btnTargetAction(self, @selector(btnSureAction:))
        .btnSetTag(101)
        ;
    }
    return _qgPhoneButton;
}
- (void)btnSureAction:(UIButton *)btn{
    NSString *str;
    if (btn.tag == 100) {
        str = [CJControl getCustomerServicePhone];
    }else{
        str = [CJControl getCustomerServiceqgPhone];
    }
    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:CJStringWithFormat(@"tel:%@",str)]];
}
@end
